<?php 
include ("config.inc.php");
function disp_full_name(){
	if(!isset($_SESSION['full_name']) || trim($_SESSION['full_name']) == ''){
	    $sql    = "SELECT fname,lname FROM clients WHERE c_id='".$_SESSION['client_id']."' LIMIT 1";
		$result = mysql_query($sql) or die(mysql_error());
		$data   = mysql_fetch_assoc($result);
		$_SESSION['full_name'] = $data['fname'] . ' ' . $data['lname'];
	}
	return $_SESSION['full_name'];

}
function disp_first_name(){
	if(!isset($_SESSION['first_name']) || trim($_SESSION['first_name']) == ''){
	    $sql    = "SELECT fname,lname FROM clients WHERE c_id='".$_SESSION['client_id']."' LIMIT 1";
		$result = mysql_query($sql) or die(mysql_error());
		$data   = mysql_fetch_assoc($result);
		$_SESSION['first_name'] = $data['fname'];
	}
	return $_SESSION['first_name'];

}
function disp_site_name(){
	if(!isset($_SESSION['site_name']) || trim($_SESSION['site_name']) == ''){
	    $sql    = "SELECT sname FROM clients WHERE c_id='".$_SESSION['client_id']."' LIMIT 1";
		$result = mysql_query($sql) or die(mysql_error());
		$data   = mysql_fetch_assoc($result);
		$_SESSION['site_name'] = $data['sname'];
	}
	return $_SESSION['site_name'];
}
function disp_site_url(){
	if(!isset($_SESSION['site_url']) || trim($_SESSION['site_url']) == ''){
	    $sql    = "SELECT surl FROM clients WHERE c_id='".$_SESSION['client_id']."' LIMIT 1";
		$result = mysql_query($sql) or die(mysql_error());
		$data   = mysql_fetch_assoc($result);
		$_SESSION['site_url'] = $data['surl'];
	}
	return $_SESSION['site_url'];
}
function disp_status(){
	if(!isset($_SESSION['status']) || trim($_SESSION['status']) == ''){
	    $sql    = "SELECT status FROM status WHERE c_id='".$_SESSION['client_id']."' LIMIT 1";
		$result = mysql_query($sql) or die(mysql_error());
		$data   = mysql_fetch_assoc($result);
		$_SESSION['status'] = $data['status'];
	}
	return $_SESSION['status'];
}
function invoice_count(){
	if(!isset($_SESSION['invoice_count']) || trim($_SESSION['invoice_count']) == ''){
	    $sql    = "SELECT * FROM invoices WHERE c_id='".$_SESSION['client_id']."'";
		$result = mysql_query($sql) or die(mysql_error());
		$count  = mysql_num_rows($result);
	}
	return $count;

}
function disp_comments(){
	    $sql    = "SELECT note,date FROM notes  WHERE c_id='".$_SESSION['client_id']."' ORDER BY date DESC LIMIT 1";
		$result = mysql_query($sql) or die(mysql_error());
		$data   = mysql_fetch_assoc($result);
		$note   = $data['note'];
		
	return $note;
}
?>
